<?php

namespace App\Transformers;

use League\Fractal\TransformerAbstract;
use App\Models\RatingSubitem;

/**
 * Class RatingSubitemTransformer.
 *
 * @package namespace App\Transformers;
 */
class RatingSubitemTransformer extends TransformerAbstract
{
    /**
     * Transform the RatingSubitem entity.
     *
     * @param \App\Models\RatingSubitem $model
     *
     * @return array
     */
    public function transform(RatingSubitem $model)
    {
        return [
            'id'         => (int) $model->id,
            'ratingCategories|category_name' => $model->ratingCategory->category_name,
            'subitem_name'     => $model->subitem_name,
            'subitem_score'     => $model->subitem_score,
            'column_width'     => $model->column_width,
            /* place your other model properties here */

            'created_at' => $model->created_at->format('Y-m-d H:i:s'),
            'updated_at' => $model->updated_at->format('Y-m-d H:i:s'),
        ];
    }
}
